<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>删列造序</title>
</head>
<body>
  <script>
    function fn(nums) {
      let n = nums[0].length
      let res = 0
      for (let i = 0; i < n; i++) {
        for (let j = 0; j < nums.length - 1; j++) {
          // 因为题目叫我们执行完删除后留下非降序的，那么只要出现降序则是需要删掉的
          // console.log(nums[j][i], nums[j+1][i])
          if (nums[j][i] > nums[j + 1][i]) {
            res++
            break
          }
        }
      }
      return res
    }
    console.log(fn(['cba', 'daf', 'ghi']))
  </script>
</body>
</html>